import {handleActions} from 'redux-actions';
import {GET_TABS, CHANGES_TABS} from '../types';
import _ from 'lodash';
const initData = [
  {
    _id: '61a4f6046b010d481c07cf8a',
    navs_id: '61a4f3fbdf30ee68cc8bb186',
    name: '面包糕点',
  },
  {
    _id: '61a4f6046b010d481c07cf8b',
    navs_id: '61a4f3fbdf30ee68cc8bb186',
    name: '	其它乳品',
  },
  {
    _id: '61a58e38ca648b205ca2d4a9',
    navs_id: '61a4f3fbdf30ee68cc8bb186',
    name: '	常温奶',
  },
  {
    _id: '61a58e41ca648b205ca2d4aa',
    navs_id: '61a4f3fbdf30ee68cc8bb186',
    name: '	低温奶',
  },
];
export const minetabs = handleActions (
  {
    [GET_TABS]: (state, {payload}) => {
      // console.log(payload);
      const {data} = payload;
      // console.log(data);
      return _.assign ({}, data);
    },
    [CHANGES_TABS]: (state, {payload}) => {
      const {_id, name, navs_id} = payload;
      console.log (_id, name, navs_id);
      return _.assign ({}, state, {_id, name, navs_id});
    },
   
  },
  initData
);
